﻿using System;
using System.IO;
using System.Reflection;
using System.Resources;
using System.Windows;

using Game.Common;
using System.Windows.Media;
using System.Windows.Media.Imaging;

namespace Game.Toolkit.Internal
{
    static class TerrainObjectResourceFile
    {
        public static BitmapImage LargeRocks1 
        {
            get { return GetImage("obj_rocks_large_1"); }
        }

        public static BitmapImage LargeRocks2
        {
            get { return GetImage("obj_rocks_large_2"); }
        }

        public static BitmapImage LargeRocks3 
        {
            get { return GetImage("obj_rocks_large_3"); }
        }

        public static BitmapImage SmallRocks1 
        {
            get { return GetImage("obj_rocks_small_1"); }
        }

        public static BitmapImage SmallRocks2
        {
            get { return GetImage("obj_rocks_small_2"); }
        }

        public static BitmapImage SmallRocks3 
        {
            get { return GetImage("obj_rocks_small_3"); }
        }

        public static BitmapImage GetImage(string name)
        {
            BitmapImage image = new BitmapImage();
            string uri = 
                @"Game.Toolkit.Resources.Landscape3."
                + name + ".png";
            Assembly a = Assembly.GetExecutingAssembly();
            Stream stream = a.GetManifestResourceStream(uri);
            image.BeginInit();
            image.StreamSource = stream;
            image.EndInit();
            
            return image;
        }
    }
}
